<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@include file="common/header.jsp"%>
        <!-- /. NAV SIDE  -->
<div id="page-wrapper">
	<div id="page-inner">

		<div class="row">
			<div class="col-md-12">
				<!-- Advanced Tables -->
				<div class="panel panel-default">
					<div class="panel-heading">房型信息表</div>

					<%-- <div class="row">
						<div class="col-md-6 col-md-push-5">
							<form method="post"
								action="${pageContext.request.contextPath }/provider/productList">
								<input type="hidden" name="proCode"
									value="${providerSession.proCode }"> <span>商品名字：</span> <input
									name="queryName" class="input-text" type="text"
									value="${p_Name }"> <input type="hidden"
									name="pageIndex" value="1" /> <input value="查 询" type="submit"
									id="searchbutton">

								<a href="${pageContext.request.contextPath}/provider/addProduct.html">添加新商品</a>
							</form>
						</div>


					</div> --%>

					<div class="panel-body">
						<div class="table-responsive">
							<table class="table table-striped table-bordered table-hover">
								<thead>
									<tr>
										<th>酒店名字</th>
										<th>编号</th>
										<th>房型</th>
										<th>设备描述</th>
										<th>价格</th>
										<th>剩余数量</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach var="room" items="${roomlist}" >

										<tr>
											<td><span>${room.hotelName }</span></td>
											<td><span>${room.room_id }</span></td>
											<td><span>${room.roomName }</span></td>
											<td><span>${room.roomDesc }</span></td>
											<td><span>${room.roomPrice }</span></td>
											<td><span>${room.rest }</span></td>
											<td>
												<span ><a title="修改"
													href="${pageContext.request.contextPath }/provider/modifyRoom?room_id=${room.room_id } "><i class="glyphicon glyphicon-edit"></i></a></span>
												<span ><a class="delete" href="javascripet:;" room_id=${room.room_id } title="删除 "><i class="glyphicon glyphicon-trash"></i> </a></span></td>
											
										</tr>

									</c:forEach>
								</tbody>
							</table>
							<input type="hidden" id="totalPageCount"
								value="${totalPageCount}" />
							<!--分页  -->
							<div class="row">
								<div class="col-md-6 col-md-push-3">
									<div class="dataTables_info" id="dataTables-example_info"
										role="alert" aria-live="polite" aria-relevant="all">共${totalCount }条记录&nbsp;&nbsp;
										${currentPageNo }/${totalPageCount }页</div>
								</div>
								<div class="col-md-4">
									<div class="dataTables_info" id="dataTables-example_paginate">

										<c:if test="${currentPageNo > 1}">
											<a href="javascript:page_nav(document.forms[0],1);">首页</a>
											<a
												href="javascript:page_nav(document.forms[0],${currentPageNo-1});">上一页</a>
										</c:if>
										<c:if test="${currentPageNo < totalPageCount }">
											<a
												href="javascript:page_nav(document.forms[0],${currentPageNo+1 });">下一页</a>
											<a
												href="javascript:page_nav(document.forms[0],${totalPageCount });">最后一页</a>
										</c:if>

									</div>
								</div>
							</div>


						</div>

					</div>
				</div>
				<!--End Advanced Tables -->
			</div>
		</div>



		<footer>
			<p>
				Copyright &copy; 2016.Company name All rights reserved.More
				Templates <a href="http://www.cssmoban.com/" target="_blank"
					title="模板之家">模板之家</a> - Collect from <a
					href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a>
			</p>

		</footer>
	</div>
	<!-- /. PAGE INNER  -->
</div>
<!-- /. PAGE WRAPPER  -->
<!-- /. WRAPPER  -->


<!-- JS Scripts-->
    <!-- jQuery Js -->
    <%@include file="common/js.jsp"%>
    <script type="text/javascript" src="${pageContext.request.contextPath }/statics/js/rollpage.js"></script>
    <script>
          $(".delete").click(function(){
		var obj = $(this);
		var deleteId= obj.attr("room_id");
		
		 if(confirm("确定要删除"+deleteId+"信息吗？")){ 
			$.ajax({
				url : "/Trip/provider/deleteRoom",
				data: {room_id:deleteId},
				dataType:"json",
				success : function(data){
					if(data.delResult=="true"){
					alert("删除成功！");
					window.location.reload();
					}else if(data.delResult=="false"){
					alert("删除失败");
					}
				}
			});
			
		}
	});
	
    </script>
    
   
</body>
</html>
